
@mixin ul {
  display:none;
  width: 60px;
  padding: 0px;
  margin: 0px;
  position: absolute;
  background-color: #888;
}

@mixin a {
  text-decoration: none;
  line-height: 20px;
  padding: 10px;
  &:hover {
    font-size: 13pt;
  }
  &:link, &:visited, &:active {
    color: #fff;
  }
}

@mixin li {
  list-style: none;
  position: relative;
  margin:0px;
  padding:0px;
  text-align: center;
  display: inline-block;
  >a {
    @include a;
  }
  @media (max-width:799px){

    text-align: left;
    display: block;
  }
  &:hover > ul {
    display:block;
  }
}


@mixin box {
  min-height: 200px;
  box-sizing:border-box;
  background-color: #efefef;
}

@mixin h1 {
  width:100%;
  font-size: 16pt;
}

@mixin ul_b {
  margin: 0;
  padding: 0;
  list-style: none;
}

@mixin p3d {
  position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
}

body{
  padding:0;
  margin:0;
}

.container{
  display: flex;
  flex-wrap:wrap;
  margin:0 auto;
  min-width: 800px;
  max-width: 1200px;
  min-height: 500px;
  @media (max-width:799px){
    min-width: 500px;
    max-width: 799px;
    min-height: 300px;
  }
  > header {
    width: 100%;
    padding:15px;
    border-radius: 20px 20px 0 0;
    background-color: #efefef;
    @media (max-width:799px){
      h2,p {
        display: none;
      }
    }
  }
  > nav {
    width: 100%;
    background:#888;
    margin: auto;
    >a {
      @include a ;
      display: none;
      @media (max-width:799px){
        display: block;
        text-align: left;
      }
    }
    >ul {
      @media (max-width:799px){
        padding-left: 10px;
        display: none;
        &.open {
          display: block;
          position: left;
        }
      }
      >.li-1 {
        @include li;
        >ul {
          display: none;
          @media (min-width:800px){
            @include ul;
            top: 30px;
          }
          >.li-2 {
            @include li;
            >ul {
              display: none;
              @media (min-width:800px){
                @include ul;
                top: 0px;
                left: 60px;
              }
              >.li-3 {
                @include li;
              }
            }
          }
        }
      }
    }
  }
  >.main {
    @include box;
    width: 80%;
    border-right: 5px solid #888;
    >.product-list {
      display: flex;
      flex-wrap:wrap;
      @media (max-width:799px){
        display: block;
      }
      > h1 {
        @include h1;
      }
      >.product {
        width:80px;
        height:120px;
        margin: 8px;
        text-align: center;
        border:3px solid #aaa;
        @media (max-width:799px){
          width:150px;
          height:200px;
        }
        > h4 {
          margin:5px;
          @media (max-width:799px){
            margin:10px;
            font-size:16pt;
          }
        }
        > img {
          width:70px;
          height: 65px;
          @media (max-width:799px){
            width: 140px;
            height: 120px;
          }
        }
        > p {
          margin:3px;
          font-size:9pt;
          color: #666;
          @media (max-width:799px){
            margin: 5px;
            font-size:12pt;
          }
        }
      }
    }
  }
  .sideline {
    @include box;
    width: 20%;
    text-align: center;
    >.links {
      text-align: center;
      min-width:90px;
      min-height:120px;
      border:3px double #888;
      margin: 20px auto 0 auto;
      @media (max-width:799px){
        position: relative;
        right: -100%;
        transition: right 1s;
        &:hover {
          right:0;
        }
      }
      >.openbutton{
        position: absolute;
        left:-40px;
        font-size: 24pt;
        font-weight: bold;
        background: #eee;
        @media (min-width:800px){
          display: none;
        }
      }
      > h1 {
        @include h1;
      }
      > p {
        font-size:9pt;
      }
      >.image {
        width: 50px;
        height: 50px;
      }
    }
    >.book {
    	position: relative;
    	min-width:50px;
      min-height:100px;
    	max-width:100px;
    	max-height:200px;
    	perspective: 1000px;
    	margin: 20px auto 0 auto;
    	transform-style: preserve-3d;

      >.hardcover_front {
        @include ul_b;
        @include p3d;

        >li {
          background-color: #aaa;
          transform: rotateY(-33deg);
          @include p3d;
          transition: all 0.8s ease;
        	transform-origin: 0% 100%;
        }
      }
      >.page {
        @include ul_b;
        @include p3d;
        > li {
          >.btn {
          	display: block;
          	margin-top:40px;
          	font-size: 12pt;
          	font-weight: bold;
          	padding: 0 10px;
            color: #888;
          	text-decoration: none;
          	text-align: center;
          	transition: color 0.3s, border-color 0.3s;
            &:hover {
            	color: red;
            }
          }
        	background: linear-gradient(to right, #bbb 0%, #fffbec 100%);
        	border-radius: 0px 5px 5px 0px;
          @for $i from 1 through 5 {
            &:nth-child(#{$i}) {
            	transform: rotateY(-17deg-3*$i);
            }
          }
          @include p3d;
          height: 98%;
        	transition: all 0.8s ease;
        	transform-origin: left center;
        }
      }
      >.book_spine {
        @include ul_b;
        @include p3d;
        transform: rotateY(60deg) translateX(-5px) translateZ(-5px);
      	width: 15px;
        > li {
        	background-color: #666;
          @include p3d;
        }
      }
      >.hardcover_back {
        @include ul_b;
        @include p3d;
        transform: rotateY(-15deg);
        > li {
        	background-color: #aaa;
          @include p3d;
        }
      }
      &:hover {
        > .hardcover_front li {
          transform: rotateY(-145deg);
          transition-duration: 1.2s;
        }
        > .page li {
          @for $i from 1 through 2 {
            &:nth-child(#{$i}) {
              transform: rotateY(-25deg-5*$i);
              transition-duration: 1.2s+0.3*$i;
            }
          }
          @for $i from 3 through 5 {
            &:nth-child(#{$i}) {
              transform: rotateY(-85deg-10*$i);
              transition-duration: 2.2s-0.2*$i;
            }
          }
        }
      }
    }
    > span {
      line-height: 50px;
    }
    >.circle{
      width:20px;
      height:20px;
      border-radius: 50%;
      position:relative;
      background: red;
      animation: test linear 3s infinite alternate;
      @keyframes test {

          0%{
            top:-10px;
            left:30%;
          }

          25%{
            top:10px;
            left:40%;
          }

          50%{
            top:-10px;
            left:50%;
          }

          75%{
            top:10px;
            left:60%;
          }
          100%{
            top:-10px;
            left:70%;
          }
      }
    }
  }

  >footer{
    width: 100%;
    padding:15px;
    border-top: 5px solid #888;
    border-radius: 0 0 20px 20px;
    background-color: #efefef;
    > p {
      margin:3px;
      font-size:6pt;
      color: #666;
      text-align: center;
    }
  }
}
